// 针对coach的API操作都写在这里

import service from ".";

// 将所有的针对coach的请求，都封装到一个对象中
const doctorsApi = {
    add(doctor){
        return service.post(
            '/doctor',
            doctor
        ).then(response=>response.data);
    },
    search(params){
        return service.get(
            '/doctor',
            {params},    // 传递参数
        ).then(response=>response.data.data);
    },
    edit(doctor){
        // console.log(doctor);
        return service.put(
            '/doctor',
            doctor,
        ).then(response=>response.data);
    },
    remove(id){
        return service.delete(
            '/doctor/'+id,
        ).then(response=>response.data);
    },
    getAll(){
        return service.get(
            '/doctor/all',
        ).then(response=>response.data);
    }
};

export default doctorsApi;